package com.roc.web.action.yycard;

import java.util.ArrayList;
import java.util.List;

import com.roc.page.BaseSearchCondition;
import com.roc.page.WhereHQLFieldBean;
import com.roc.util.Constance;

@SuppressWarnings("serial")
public class ScanCodeAuditSearchCondition extends BaseSearchCondition{

	private String mcthCd;
	private String wxId;
	private String wxName;
	private String dateMax;
	private String dateMin;
	private String status;
	@Override
	protected List<WhereHQLFieldBean> getWhereHQLFieldBeanList() {
		List<WhereHQLFieldBean> filedBeanList = new ArrayList<WhereHQLFieldBean>();
		if(Constance.isNotEmpty(mcthCd))
		{
			filedBeanList.add(new WhereHQLFieldBean("s.mcht_cd", mcthCd.trim(),"=", false));
		}
		if(Constance.isNotEmpty(wxId))
		{
			filedBeanList.add(new WhereHQLFieldBean("s.wx_id", wxId.trim(),"=", false));
		}
		if(Constance.isNotEmpty(wxName))
		{
			filedBeanList.add(new WhereHQLFieldBean("s.wx_name", wxName.trim(),"LIKE", false, "ALL"));
		}
		if(Constance.isNotEmpty(dateMin)){
			filedBeanList.add(new WhereHQLFieldBean("to_char(s.up_create,'YYYYMMDD')", dateMin.trim(),">=", false));
		}
		if(Constance.isNotEmpty(dateMax)){
			filedBeanList.add(new WhereHQLFieldBean("to_char(s.up_create,'YYYYMMDD')", dateMax.trim(),"<=", false));
		}
		if(Constance.isNotEmpty(status)){
			filedBeanList.add(new WhereHQLFieldBean("s.status",status.trim(),"=", false));
		}
		return filedBeanList;
	}

	@Override
	protected String getRowCountHQL() {
		StringBuffer sb = new StringBuffer();
		sb.append("select count(*) from t_wx_audit s,tbl_mcht_inf t where  s.mcht_cd=t.mcht_cd ");
		return sb.toString();
	}

	@Override
	protected String getSearchHQL() {
		StringBuffer sb = new StringBuffer();
		sb.append("select s.mcht_cd,t.name,s.wx_id,s.wx_name,s.wx_subid,s.status,to_char(s.up_create,'YYYYMMDD') upc,s.counts from t_wx_audit s,tbl_mcht_inf t where  s.mcht_cd=t.mcht_cd ");
		return sb.toString();
	}

	@Override
	protected String getOrderPartOfHQL() {		
		return "order by s.up_create desc";
	}

	public String getMcthCd() {
		return mcthCd;
	}

	public void setMcthCd(String mcthCd) {
		this.mcthCd = mcthCd;
	}

	public String getWxId() {
		return wxId;
	}

	public void setWxId(String wxId) {
		this.wxId = wxId;
	}

	public String getWxName() {
		return wxName;
	}

	public void setWxName(String wxName) {
		this.wxName = wxName;
	}

	public String getDateMax() {
		return dateMax;
	}

	public void setDateMax(String dateMax) {
		this.dateMax = dateMax;
	}

	public String getDateMin() {
		return dateMin;
	}

	public void setDateMin(String dateMin) {
		this.dateMin = dateMin;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	

	
}
